/*******************************************************************************
 * Copyright 2011 Alexandre Zglav and Morphiastic
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package com.morphiastic.tests.entities.shape;

import com.google.code.morphia.annotations.Entity;
import com.morphiastic.analysis.analyzers.CustomAnalyzer;
import com.morphiastic.analysis.analyzers.ElasticAnalyzerType;
import com.morphiastic.analysis.filters.ElasticFilterType;
import com.morphiastic.analysis.filters.PhoneticTokenFilter;
import com.morphiastic.analysis.filters.ShingleTokenFilter;
import com.morphiastic.analysis.tokenizers.EdgeNGramTokenizer;
import com.morphiastic.analysis.tokenizers.ElasticTokenizerType;
import com.morphiastic.annotations.Analyzer;
import com.morphiastic.annotations.Boost;
import com.morphiastic.annotations.ElastiField;
import com.morphiastic.annotations.ElastiMorphed;
import com.morphiastic.annotations.FilterDefinition;
import com.morphiastic.annotations.FilterDefinitions;
import com.morphiastic.annotations.Parameter;
import com.morphiastic.annotations.TokenizerDefinition;

@Entity("shape")
@ElastiMorphed(typeName="trapezium")
@TokenizerDefinition(defName="trapeziumPropTokenizer", type=ElasticTokenizerType.edgeNGram, 
		parameters = {
			@Parameter(key=EdgeNGramTokenizer.MIN_GRAM_PARAM_KEY, value="2"),
			@Parameter(key=EdgeNGramTokenizer.MAX_GRAM_PARAM_KEY, value="4"),
			@Parameter(key=EdgeNGramTokenizer.SIDE_PARAM_KEY, value=EdgeNGramTokenizer.FRONT)
		}
)
//Multiple filter definitions
@FilterDefinitions({
	@FilterDefinition(defName="trapeziumPhoneticFilter", type=ElasticFilterType.phonetic, 
			parameters={
				@Parameter(key=PhoneticTokenFilter.ENCODER_PARAM_KEY, value=PhoneticTokenFilter.metaphone),
				@Parameter(key=PhoneticTokenFilter.REPLACE_PARAM_KEY, value="false")
			} 
	),
	@FilterDefinition(defName="trapeziumShingleFilter", type=ElasticFilterType.shingle, 
			parameters={
				@Parameter(key=ShingleTokenFilter.MAX_SHINGLE_SIZE_PARAM_KEY, value="4"),
				@Parameter(key=ShingleTokenFilter.OUTPUT_UNIGRAMS_PARAM_KEY, value="false")
			} 
	)
})
public class Trapezium extends Quadrilateral{

	
	
	@ElastiField(
		analyzer=@Analyzer(
			defName="trapeziumPropAnalizer", 
			type=ElasticAnalyzerType.custom , 
			parameters ={
				@Parameter(key=CustomAnalyzer.TOKENIZER_PARAM_KEY,value="trapeziumPropTokenizer"),
				@Parameter(key=CustomAnalyzer.FILTERS_PARAM_KEY, value="trapeziumPhoneticFilter, trapeziumShingleFilter") //comma separated values for each filter used
			}
		),
		boost=@Boost(value=2.0f)
	)
	private String specialTrapeziumProp;

	/**
	 * @return the specialTrapeziumProp
	 */
	public String getSpecialTrapeziumProp() {
		return specialTrapeziumProp;
	}

	/**
	 * @param specialTrapeziumProp the specialTrapeziumProp to set
	 */
	public void setSpecialTrapeziumProp(String specialTrapeziumProp) {
		this.specialTrapeziumProp = specialTrapeziumProp;
	}
	
	
}
